package com.lifang.imsoa.util;

import java.util.Date;

import com.lifang.utils.WebTool;

public class Tool {

	private static final Date 缓存10秒钟 = new Date(10 * 1000);

	private static final Date 缓存1分钟 = new Date(1 * 60 * 1000);

	private static final Date 缓存5分钟 = new Date(5 * 60 * 1000);

	private static final Date 缓存10分钟 = new Date(10 * 60 * 1000);

	private static final Date 缓存30分钟 = new Date(30 * 60 * 1000);

	private static final Date 缓存1小时 = new Date(3600 * 1000);

	private static final Date 缓存2小时 = new Date(2 * 3600 * 1000);

	private static final Date 缓存3小时 = new Date(3 * 3600 * 1000);

	private static final Date 缓存6小时 = new Date(6 * 3600 * 1000);

	private static final Date 缓存10小时 = new Date(10 * 3600 * 1000);

	private static final Date 缓存12小时 = new Date(12 * 3600 * 1000);

	private static final Date 缓存24小时 = new Date(24 * 3600 * 1000);

	private static final Date 缓存7天 = new Date(7 * 24 * 3600 * 1000);

	private static final Date 缓存10天 = new Date(10 * 24 * 3600 * 1000);

	private static final Date 缓存30天 = new Date(30 * 24 * 3600 * 1000);

	private static final Date 缓存100年 = new Date(100 * 365 * 24 * 3600 * 1000);

	public static Date 缓存1分钟() {
		return isTest() || isBeta() ? 缓存1分钟 : 缓存1分钟;
	}

	/** 测试环境只缓存60秒钟 */
	public static Date 缓存10分钟() {
		return isTest() || isBeta() ? 缓存1分钟 : 缓存10分钟;
	}

	public static Date 缓存30分钟() {
		return isTest() || isBeta() ? 缓存10分钟 : 缓存30分钟;
	}

	public static Date 缓存1小时() {
		return isTest() || isBeta() ? 缓存10分钟 : 缓存1小时;
	}

	public static boolean isTest() {
		return WebTool.hostNameStartsWith("192.168.1.");
	}

	public static boolean isBeta() {
		return WebTool.hostNameStartsWith("192.168.1.");
	}

}
